<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateProjectsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('projects', function (Blueprint $table) {
            $table->increments('id');
            $table->integer("user_id", 0, 1)->comment("添加项目的用户id");
            $table->string("name")->default("master")->nullable()->comment("项目名称");
            $table->tinyInteger("level")->default("1")->comment("项目环境：1：测试，2：线上");
            $table->tinyInteger("status")->default("1")->comment("状态：0：无效，1有效");
            $table->string("version")->nullable()->comment("线上当前版本，用于快速回滚");
            $table->string("repo_url")->nullable()->default("")->comment("git地址");
            $table->text("pre_deploy")->nullable()->comment("部署前置任务");
            $table->text("post_deploy")->nullable()->comment("同步之前任务");
            $table->text("pre_release")->nullable()->comment("同步之前目标机器执行的任务");
            $table->text("post_release")->nullable()->comment("同步之后目标机器执行的任务");
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('projects');
    }
}
